import axios from 'axios';
import vuex from '../store/index';
import { url } from '../utils/config';
export function request(config) {
  const ins = axios.create({
    // baseURL: 'http://localhost:8080/api',
    baseURL: url,
  });

  ins.interceptors.request.use(
    (config) => {
      config.headers.Authorization = vuex.state.authorization;
      return config;
    },
    (error) => {
      console.log(error);
    }
  );
  ins.interceptors.response.use((res) => {
    return res.data;
  });
  return ins(config);
}
